home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 92 / CDMM92_1.ISO / SOF 2 SDK / sof2sdk-101.msi / _92D6AC311BB48EBA344BBABC89DA6AB0 / _55D2C7F15F6D4A76B9F764DB3CE5049B < prev    next >
Encoding:
Text File  |  2002-06-12  |  29.5 KB  |  1,008 lines

  1. // Copyright (C) 2001-2002 Raven Software.
  2. //
  3. #ifndef __UI_LOCAL_H__
  4. #define __UI_LOCAL_H__
  5.  
  6. #ifndef    __Q_SHARED_H
  7.     #include "../game/q_shared.h"
  8. #endif
  9.  
  10. #include "../cgame/tr_types.h"
  11. #include "ui_public.h"
  12. #include "keycodes.h"
  13. #include "../game/bg_public.h"
  14. #include "ui_shared.h"
  15.  
  16. // global display context
  17.  
  18. extern vmCvar_t    ui_arenasFile;
  19. extern vmCvar_t    ui_botsFile;
  20.  
  21. extern vmCvar_t    ui_browserMaster;
  22. extern vmCvar_t    ui_browserGameType;
  23. extern vmCvar_t    ui_browserSortKey;
  24. extern vmCvar_t    ui_browserShowFull;
  25. extern vmCvar_t    ui_browserShowEmpty;
  26.  
  27. extern vmCvar_t    ui_drawCrosshair;
  28. extern vmCvar_t    ui_drawCrosshairNames;
  29.  
  30. extern vmCvar_t    ui_server1;
  31. extern vmCvar_t    ui_server2;
  32. extern vmCvar_t    ui_server3;
  33. extern vmCvar_t    ui_server4;
  34. extern vmCvar_t    ui_server5;
  35. extern vmCvar_t    ui_server6;
  36. extern vmCvar_t    ui_server7;
  37. extern vmCvar_t    ui_server8;
  38. extern vmCvar_t    ui_server9;
  39. extern vmCvar_t    ui_server10;
  40. extern vmCvar_t    ui_server11;
  41. extern vmCvar_t    ui_server12;
  42. extern vmCvar_t    ui_server13;
  43. extern vmCvar_t    ui_server14;
  44. extern vmCvar_t    ui_server15;
  45. extern vmCvar_t    ui_server16;
  46.  
  47. extern vmCvar_t    ui_cdkey;
  48. extern vmCvar_t    ui_cdkeychecked;
  49. extern vmCvar_t    ui_invalidversion;
  50.  
  51. extern vmCvar_t    ui_scoreLimit;
  52. extern vmCvar_t    ui_gameType;
  53. extern vmCvar_t    ui_netGameType;
  54. extern vmCvar_t    ui_actualNetGameType;
  55. extern vmCvar_t    ui_joinGameType;
  56. extern vmCvar_t    ui_netSource;
  57. extern vmCvar_t    ui_serverFilterType;
  58. extern vmCvar_t    ui_dedicated;
  59. extern vmCvar_t    ui_menuFiles;
  60. extern vmCvar_t    ui_currentMap;
  61. extern vmCvar_t    ui_currentNetMap;
  62. extern vmCvar_t    ui_mapIndex;
  63. extern vmCvar_t    ui_selectedPlayer;
  64. extern vmCvar_t    ui_selectedPlayerName;
  65. extern vmCvar_t    ui_lastServerRefresh_0;
  66. extern vmCvar_t    ui_lastServerRefresh_1;
  67. extern vmCvar_t    ui_lastServerRefresh_2;
  68. extern vmCvar_t    ui_lastServerRefresh_3;
  69. extern vmCvar_t ui_serverStatusTimeOut;
  70. extern vmCvar_t    ui_botteam;
  71.  
  72. extern vmCvar_t    ui_info_redteam;
  73. extern vmCvar_t    ui_info_blueteam;
  74. extern vmCvar_t ui_info_redcount;
  75. extern vmCvar_t ui_info_bluecount;
  76. extern vmCvar_t ui_info_redscore;
  77. extern vmCvar_t    ui_info_bluescore;
  78. extern vmCvar_t    ui_info_timer;
  79. extern vmCvar_t    ui_info_objectives;
  80. extern vmCvar_t    ui_info_gametype;
  81. extern vmCvar_t    ui_info_team;
  82. extern vmCvar_t    ui_joinserver;
  83.  
  84. extern vmCvar_t    ui_allowparental;
  85.  
  86. extern vmCvar_t    ui_noNetCheck;
  87.  
  88. typedef void        *TGhoul2;
  89.  
  90. #define G2SURFACEFLAG_ISBOLT        0x00000001
  91. #define G2SURFACEFLAG_OFF            0x00000002    // saves strcmp()ing for "_off" in surface names
  92. #define G2SURFACEFLAG_SPARE0        0x00000004    // future-expansion fields, saves invalidating models if we add more
  93. #define G2SURFACEFLAG_SPARE1        0x00000008    //   
  94. #define G2SURFACEFLAG_SPARE2        0x00000010    // 
  95. #define G2SURFACEFLAG_SPARE3        0x00000020    // 
  96. #define G2SURFACEFLAG_SPARE4        0x00000040    // 
  97. #define G2SURFACEFLAG_SPARE5        0x00000080    // 
  98. //
  99. #define G2SURFACEFLAG_NODESCENDANTS 0x00000100    // ingame-stuff, never generated by Carcass....
  100. #define G2SURFACEFLAG_GENERATED        0x00000200    //
  101.  
  102. //
  103. // ui_qmenu.c
  104. //
  105.  
  106. #define RCOLUMN_OFFSET            ( BIGCHAR_WIDTH )
  107. #define LCOLUMN_OFFSET            (-BIGCHAR_WIDTH )
  108.  
  109. #define SLIDER_RANGE            10
  110. #define    MAX_EDIT_LINE            256
  111.  
  112. #define MAX_MENUDEPTH            8
  113. #define MAX_MENUITEMS            128
  114.  
  115. #define MTYPE_NULL                0
  116. #define MTYPE_SLIDER            1    
  117. #define MTYPE_ACTION            2
  118. #define MTYPE_SPINCONTROL        3
  119. #define MTYPE_FIELD                4
  120. #define MTYPE_RADIOBUTTON        5
  121. #define MTYPE_BITMAP            6    
  122. #define MTYPE_TEXT                7
  123. #define MTYPE_SCROLLLIST        8
  124. #define MTYPE_PTEXT                9
  125. #define MTYPE_BTEXT                10
  126.  
  127. #define QMF_BLINK                0x00000001
  128. #define QMF_SMALLFONT            0x00000002
  129. #define QMF_LEFT_JUSTIFY        0x00000004
  130. #define QMF_CENTER_JUSTIFY        0x00000008
  131. #define QMF_RIGHT_JUSTIFY        0x00000010
  132. #define QMF_NUMBERSONLY            0x00000020    // edit field is only numbers
  133. #define QMF_HIGHLIGHT            0x00000040
  134. #define QMF_HIGHLIGHT_IF_FOCUS    0x00000080    // steady focus
  135. #define QMF_PULSEIFFOCUS        0x00000100    // pulse if focus
  136. #define QMF_HASMOUSEFOCUS        0x00000200
  137. #define QMF_NOONOFFTEXT            0x00000400
  138. #define QMF_MOUSEONLY            0x00000800    // only mouse input allowed
  139. #define QMF_HIDDEN                0x00001000    // skips drawing
  140. #define QMF_GRAYED                0x00002000    // grays and disables
  141. #define QMF_INACTIVE            0x00004000    // disables any input
  142. #define QMF_NODEFAULTINIT        0x00008000    // skip default initialization
  143. #define QMF_OWNERDRAW            0x00010000
  144. #define QMF_PULSE                0x00020000
  145. #define QMF_LOWERCASE            0x00040000    // edit field is all lower case
  146. #define QMF_UPPERCASE            0x00080000    // edit field is all upper case
  147. #define QMF_SILENT                0x00100000
  148.  
  149. // callback notifications
  150. #define QM_GOTFOCUS                1
  151. #define QM_LOSTFOCUS            2
  152. #define QM_ACTIVATED            3
  153.  
  154. typedef struct _tag_menuframework
  155. {
  156.     int    cursor;
  157.     int cursor_prev;
  158.  
  159.     int    nitems;
  160.     void *items[MAX_MENUITEMS];
  161.  
  162.     void (*draw) (void);
  163.     sfxHandle_t (*key) (int key);
  164.  
  165.     qboolean    wrapAround;
  166.     qboolean    fullscreen;
  167.     qboolean    showlogo;
  168. } menuframework_s;
  169.  
  170. typedef struct
  171. {
  172.     int type;
  173.     const char *name;
  174.     int    id;
  175.     int x, y;
  176.     int left;
  177.     int    top;
  178.     int    right;
  179.     int    bottom;
  180.     menuframework_s *parent;
  181.     int menuPosition;
  182.     unsigned flags;
  183.  
  184.     void (*callback)( void *self, int event );
  185.     void (*statusbar)( void *self );
  186.     void (*ownerdraw)( void *self );
  187. } menucommon_s;
  188.  
  189. typedef struct {
  190.     int        cursor;
  191.     int        scroll;
  192.     int        widthInChars;
  193.     char    buffer[MAX_EDIT_LINE];
  194.     int        maxchars;
  195. } mfield_t;
  196.  
  197. typedef struct
  198. {
  199.     menucommon_s    generic;
  200.     mfield_t        field;
  201. } menufield_s;
  202.  
  203. typedef struct 
  204. {
  205.     menucommon_s generic;
  206.  
  207.     float minvalue;
  208.     float maxvalue;
  209.     float curvalue;
  210.  
  211.     float range;
  212. } menuslider_s;
  213.  
  214. typedef struct
  215. {
  216.     menucommon_s generic;
  217.  
  218.     int    oldvalue;
  219.     int curvalue;
  220.     int    numitems;
  221.     int    top;
  222.         
  223.     const char **itemnames;
  224.  
  225.     int width;
  226.     int height;
  227.     int    columns;
  228.     int    seperation;
  229. } menulist_s;
  230.  
  231. typedef struct
  232. {
  233.     menucommon_s generic;
  234. } menuaction_s;
  235.  
  236. typedef struct
  237. {
  238.     menucommon_s generic;
  239.     int curvalue;
  240. } menuradiobutton_s;
  241.  
  242. typedef struct
  243. {
  244.     menucommon_s    generic;
  245.     char*            focuspic;    
  246.     char*            errorpic;
  247.     qhandle_t        shader;
  248.     qhandle_t        focusshader;
  249.     int                width;
  250.     int                height;
  251.     float*            focuscolor;
  252. } menubitmap_s;
  253.  
  254. typedef struct
  255. {
  256.     menucommon_s    generic;
  257.     char*            string;
  258.     int                style;
  259.     float*            color;
  260. } menutext_s;
  261.  
  262. extern void            Menu_Cache( void );
  263. extern void            Menu_Focus( menucommon_s *m );
  264. extern void            Menu_AddItem( menuframework_s *menu, void *item );
  265. extern void            Menu_AdjustCursor( menuframework_s *menu, int dir );
  266. extern void            Menu_Draw( menuframework_s *menu );
  267. extern void            *Menu_ItemAtCursor( menuframework_s *m );
  268. extern sfxHandle_t    Menu_ActivateItem( menuframework_s *s, menucommon_s* item );
  269. extern void            Menu_SetCursor( menuframework_s *s, int cursor );
  270. extern void            Menu_SetCursorToItem( menuframework_s *m, void* ptr );
  271. extern sfxHandle_t    Menu_DefaultKey( menuframework_s *s, int key );
  272. extern void            Bitmap_Init( menubitmap_s *b );
  273. extern void            Bitmap_Draw( menubitmap_s *b );
  274. extern void            ScrollList_Draw( menulist_s *l );
  275. extern sfxHandle_t    ScrollList_Key( menulist_s *l, int key );
  276. extern sfxHandle_t    menu_in_sound;
  277. extern sfxHandle_t    menu_move_sound;
  278. extern sfxHandle_t    menu_out_sound;
  279. extern sfxHandle_t    menu_buzz_sound;
  280. extern sfxHandle_t    menu_null_sound;
  281. extern sfxHandle_t    weaponChangeSound;
  282. extern vec4_t        menu_text_color;
  283. extern vec4_t        menu_grayed_color;
  284. extern vec4_t        menu_dark_color;
  285. extern vec4_t        menu_highlight_color;
  286. extern vec4_t        menu_red_color;
  287. extern vec4_t        menu_black_color;
  288. extern vec4_t        menu_dim_color;
  289. extern vec4_t        color_black;
  290. extern vec4_t        color_white;
  291. extern vec4_t        color_yellow;
  292. extern vec4_t        color_blue;
  293. extern vec4_t        color_orange;
  294. extern vec4_t        color_red;
  295. extern vec4_t        color_dim;
  296. extern vec4_t        name_color;
  297. extern vec4_t        list_color;
  298. extern vec4_t        listbar_color;
  299. extern vec4_t        text_color_disabled; 
  300. extern vec4_t        text_color_normal;
  301. extern vec4_t        text_color_highlight;
  302.  
  303. //
  304. // ui_main.c
  305. //
  306. void UI_Report                ( void );
  307. void UI_Reload                ( void );
  308. void UI_LoadMenus            ( const char *menuFile, qboolean reset );
  309. void UI_SetActiveMenu        ( uiMenuCommand_t menu );
  310. int     UI_AdjustTimeByGame    ( int time );
  311. void UI_LoadArenas            ( void );
  312.  
  313. void UI_DrawConnectScreen( qboolean overlay );
  314. void UI_DrawLoadingScreen( void ) ;
  315.  
  316. //
  317. // ui_menu.c
  318. //
  319. extern void MainMenu_Cache( void );
  320. extern void UI_MainMenu(void);
  321. extern void UI_RegisterCvars( void );
  322. extern void UI_UpdateCvars( void );
  323.  
  324.  
  325. //
  326. // ui_players.c
  327. //
  328. void    UI_LoadIdentityIcons    ( void );
  329. TGhoul2 UI_RegisterIdentity        ( const char *identityName, char *animationFile );
  330.  
  331. //FIXME ripped from cg_local.h
  332. typedef struct {
  333.     int            oldFrame;
  334.     int            oldFrameTime;        // time when ->oldFrame was exactly on
  335.  
  336.     int            frame;
  337.     int            frameTime;            // time when ->frame will be exactly on
  338.  
  339.     float        backlerp;
  340.  
  341.     float        yawAngle;
  342.     qboolean    yawing;
  343.     float        pitchAngle;
  344.     qboolean    pitching;
  345.  
  346.     int            animationNumber;    // may include ANIM_TOGGLEBIT
  347.     animation_t    *animation;
  348.     int            animationTime;        // time when the first frame of the animation will be exact
  349. } lerpFrame_t;
  350.  
  351. typedef struct {
  352.     // model info
  353.     qhandle_t        playerModel;
  354.     void            *playerG2Model;
  355.  
  356.     int                legsOldAnim;
  357.     lerpFrame_t        legs;
  358.  
  359. //    qhandle_t        torsoModel;
  360. //    qhandle_t        torsoSkin;
  361.     lerpFrame_t        torso;
  362.  
  363. //    qhandle_t        headModel;
  364. //    qhandle_t        headSkin;
  365.  
  366.     animation_t        animations[MAX_ANIMATIONS];
  367.  
  368. //    qhandle_t        weaponModel;
  369. //    qhandle_t        barrelModel;
  370. //    qhandle_t        flashModel;
  371.     void            *weaponG2Model;        // ghoul2 models
  372.  
  373.     vec3_t            flashDlightColor;
  374.     int                muzzleFlashTime;
  375.  
  376.     // currently in use drawing parms
  377.     vec3_t            viewAngles;
  378.     vec3_t            moveAngles;
  379.     weapon_t        currentWeapon;
  380.     int                legsAnim;
  381.     int                torsoAnim;
  382.  
  383.     // animation vars
  384.     weapon_t        weapon;
  385.     weapon_t        lastWeapon;
  386.     weapon_t        pendingWeapon;
  387.     int                weaponTimer;
  388.     int                pendingLegsAnim;
  389.     int                torsoAnimationTimer;
  390.  
  391.     int                pendingTorsoAnim;
  392.     int                legsAnimationTimer;
  393.  
  394.     qboolean        chat;
  395.     qboolean        newModel;
  396.  
  397.     qboolean        barrelSpinning;
  398.     float            barrelAngle;
  399.     int                barrelTime;
  400.  
  401.     int                realWeapon;
  402. } playerInfo_t;
  403.  
  404. void        UI_DrawPlayer                ( float x, float y, float w, float h, playerInfo_t *pi, int time );
  405. void        UI_PlayerInfo_SetIdentity    ( playerInfo_t *pi, const char *identityName );
  406. void        UI_PlayerInfo_SetInfo        ( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNum, qboolean chat );
  407. qboolean    UI_RegisterClientIdentity    ( playerInfo_t *pi, const char *identityName );
  408.  
  409. //
  410. // ui_atoms.c
  411. //
  412. // this is only used in the old ui, the new ui has it's own version
  413. typedef struct {
  414.     int                    frametime;
  415.     int                    realtime;
  416.     int                    cursorx;
  417.     int                    cursory;
  418.     glconfig_t     glconfig;
  419.     qboolean        debug;
  420.     qhandle_t        whiteShader;
  421.     qhandle_t        menuBackShader;
  422.     qhandle_t        menuBackShader2;
  423.     qhandle_t        menuBackNoLogoShader;
  424.     qhandle_t        charset;
  425.     qhandle_t        charsetProp;
  426.     qhandle_t        charsetPropGlow;
  427.     qhandle_t        charsetPropB;
  428.     qhandle_t        cursor;
  429.     qhandle_t        rb_on;
  430.     qhandle_t        rb_off;
  431.     float                scale;
  432.     float                bias;
  433.     qboolean        demoversion;
  434.     qboolean        firstdraw;
  435. } uiStatic_t;
  436.  
  437.  
  438. // new ui stuff
  439. #define UI_NUMFX 7
  440. #define MAX_HEADS 64
  441. #define MAX_ALIASES 64
  442. #define MAX_HEADNAME  32
  443. #define MAX_MAPS 128
  444. #define MAX_SPMAPS 16
  445. #define PLAYERS_PER_TEAM 5
  446. #define MAX_PINGREQUESTS        32
  447. #define MAX_ADDRESSLENGTH        64
  448. #define MAX_HOSTNAMELENGTH        22
  449. #define MAX_MAPNAMELENGTH        16
  450. #define MAX_STATUSLENGTH        64
  451. #define MAX_LISTBOXWIDTH        59
  452. #define UI_FONT_THRESHOLD        0.1
  453. #define MAX_DISPLAY_SERVERS        2048
  454. #define MAX_SERVERSTATUS_LINES    128
  455. #define MAX_SERVERSTATUS_TEXT    4096
  456. #define MAX_FOUNDPLAYER_SERVERS    16
  457. #define TEAM_MEMBERS 5
  458. #define MAPS_PER_TIER 3
  459. #define MAX_TIERS 16
  460. #define MAX_MODS 64
  461. #define MAX_DEMOS 256
  462. #define MAX_MOVIES                256
  463. #define    MAX_PLAYERIDENTITIES    200
  464. #define    MAX_TEAMIDENTITIES        5
  465.  
  466.  
  467. typedef struct {
  468.   const char *name;
  469.     const char *imageName;
  470.   qhandle_t headImage;
  471.     const char *base;
  472.     qboolean active;
  473.     int reference;
  474. } characterInfo;
  475.  
  476. typedef struct {
  477.     const char *name;
  478.     const char *ai;
  479.     const char *action;
  480. } aliasInfo;
  481.  
  482. typedef struct {
  483.   const char *teamName;
  484.     const char *imageName;
  485.     const char *teamMembers[TEAM_MEMBERS];
  486.   qhandle_t teamIcon;
  487.   qhandle_t teamIcon_Metal;
  488.   qhandle_t teamIcon_Name;
  489.     int cinematic;
  490. } teamInfo;
  491.  
  492. typedef struct {
  493.   const char *gameType;
  494.   int gtEnum;
  495. } gameTypeInfo;
  496.  
  497. typedef struct {
  498.   const char *mapName;
  499.   const char *mapLoadName;
  500.     const char *imageName;
  501.     const char *opponentName;
  502.     int teamMembers;
  503.   int typeBits;
  504.     int cinematic;
  505.     int timeToBeat[MAX_GAMETYPES];
  506.     qhandle_t levelShot;
  507.     qboolean active;
  508. } mapInfo;
  509.  
  510. typedef struct {
  511.     const char *tierName;
  512.     const char *maps[MAPS_PER_TIER];
  513.     int gameTypes[MAPS_PER_TIER];
  514.     qhandle_t mapHandles[MAPS_PER_TIER];
  515. } tierInfo;
  516.  
  517. typedef struct serverFilter_s {
  518.     const char *description;
  519.     const char *basedir;
  520. } serverFilter_t;
  521.  
  522. typedef struct {
  523.     char    adrstr[MAX_ADDRESSLENGTH];
  524.     int        start;
  525. } pinglist_t;
  526.  
  527.  
  528. typedef struct serverStatus_s {
  529.     pinglist_t pingList[MAX_PINGREQUESTS];
  530.     int        numqueriedservers;
  531.     int        currentping;
  532.     int        nextpingtime;
  533.     int        maxservers;
  534.     int        refreshtime;
  535.     int        numServers;
  536.     int        sortKey;
  537.     int        sortDir;
  538.     int        lastCount;
  539.     qboolean refreshActive;
  540.     int        currentServer;
  541.     int        displayServers[MAX_DISPLAY_SERVERS];
  542.     int        numDisplayServers;
  543.     int        numPlayersOnServers;
  544.     int        nextDisplayRefresh;
  545.     int        nextSortTime;
  546.     qhandle_t currentServerPreview;
  547.     int        currentServerCinematic;
  548.     int        motdLen;
  549.     int        motdWidth;
  550.     int        motdPaintX;
  551.     int        motdPaintX2;
  552.     int        motdOffset;
  553.     int        motdTime;
  554.     char    motd[MAX_STRING_CHARS];
  555. } serverStatus_t;
  556.  
  557.  
  558. typedef struct {
  559.     char        adrstr[MAX_ADDRESSLENGTH];
  560.     char        name[MAX_ADDRESSLENGTH];
  561.     int            startTime;
  562.     int            serverNum;
  563.     qboolean    valid;
  564. } pendingServer_t;
  565.  
  566. typedef struct {
  567.     int num;
  568.     pendingServer_t server[MAX_SERVERSTATUSREQUESTS];
  569. } pendingServerStatus_t;
  570.  
  571. typedef struct {
  572.     char address[MAX_ADDRESSLENGTH];
  573.     char *lines[MAX_SERVERSTATUS_LINES][4];
  574.     char text[MAX_SERVERSTATUS_TEXT];
  575.     char pings[MAX_CLIENTS * 3];
  576.     int numLines;
  577. } serverStatusInfo_t;
  578.  
  579. typedef struct {
  580.     const char *modName;
  581.     const char *modDescr;
  582. } modInfo_t;
  583.  
  584.  
  585. typedef struct 
  586. {
  587.     displayContextDef_t uiDC;
  588.     int newHighScoreTime;
  589.     int newBestTime;
  590.     int showPostGameTime;
  591.     qboolean newHighScore;
  592.     qboolean demoAvailable;
  593.     qboolean soundHighScore;
  594.     
  595.     int botIndex;
  596.  
  597.     int aliasCount;
  598.     aliasInfo aliasList[MAX_ALIASES];
  599.  
  600.     int redBlue;
  601.     int playerCount;
  602.     int myTeamCount;
  603.     int teamIndex;
  604.     int playerRefresh;
  605.     int playerIndex;
  606.     int playerNumber; 
  607.     qboolean teamLeader;
  608.     char playerNames[MAX_CLIENTS][MAX_NAME_LENGTH];
  609.     char teamNames[MAX_CLIENTS][MAX_NAME_LENGTH];
  610.     int teamClientNums[MAX_CLIENTS];
  611.  
  612.     int mapCount;
  613.     mapInfo mapList[MAX_MAPS];
  614.  
  615.  
  616.     int tierCount;
  617.     tierInfo tierList[MAX_TIERS];
  618.  
  619.     int skillIndex;
  620.  
  621.     modInfo_t modList[MAX_MODS];
  622.     int modCount;
  623.     int modIndex;
  624.  
  625.     const char *demoList[MAX_DEMOS];
  626.     int demoCount;
  627.     int demoIndex;
  628.  
  629.     const char *movieList[MAX_MOVIES];
  630.     int movieCount;
  631.     int movieIndex;
  632.     int previewMovie;
  633.  
  634.     serverStatus_t serverStatus;
  635.  
  636.     // for the showing the status of a server
  637.     char serverStatusAddress[MAX_ADDRESSLENGTH];
  638.     serverStatusInfo_t serverStatusInfo;
  639.     int nextServerStatusRefresh;
  640.  
  641.     // to retrieve the status of server to find a player
  642.     pendingServerStatus_t pendingServerStatus;
  643.     char findPlayerName[MAX_STRING_CHARS];
  644.     char foundPlayerServerAddresses[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
  645.     char foundPlayerServerNames[MAX_FOUNDPLAYER_SERVERS][MAX_ADDRESSLENGTH];
  646.     int currentFoundPlayerServer;
  647.     int numFoundPlayerServers;
  648.     int nextFindPlayerRefresh;
  649.  
  650.     int currentCrosshair;
  651.     int startPostGameTime;
  652.  
  653.     TIdentity*        identityTeams[TEAM_NUM_TEAMS][MAX_TEAMIDENTITIES];
  654.     int                identitySelected;
  655.  
  656.     qboolean        inGameLoad;
  657.  
  658.     char            parentalPassword[MAX_QPATH];
  659.  
  660.     qboolean        connectPasswordRequest;
  661.  
  662.     int                outfittingItemGroup;
  663.  
  664.     int                versionIndex;
  665.  
  666.     const char*        menusFile;
  667.  
  668. }    uiInfo_t;
  669.  
  670.  
  671. extern uiInfo_t uiInfo;
  672.  
  673.  
  674. extern void            UI_Init( void );
  675. extern void            UI_Shutdown( void );
  676. extern void            UI_KeyEvent( int key );
  677. extern void            UI_MouseEvent( int dx, int dy );
  678. extern void            UI_Refresh( int realtime );
  679. extern qboolean        UI_ConsoleCommand( int realTime );
  680. extern void            UI_DrawNamedPic( float x, float y, float width, float height, const char *picname );
  681. extern void            UI_DrawHandlePic( float x, float y, float w, float h, qhandle_t hShader ); 
  682. extern void            UI_FillRect( float x, float y, float width, float height, const float *color );
  683. extern void            UI_DrawRect( float x, float y, float width, float height, const float *color );
  684. extern void     UI_DrawTopBottom(float x, float y, float w, float h);
  685. extern void     UI_DrawSides(float x, float y, float w, float h);
  686. extern void            UI_UpdateScreen( qboolean IsLoading );
  687. extern void            UI_SetColor( const float *rgba );
  688. extern void            UI_LerpColor(vec4_t a, vec4_t b, vec4_t c, float t);
  689. extern void            UI_DrawBannerString( int x, int y, const char* str, int style, vec4_t color );
  690. extern float        UI_ProportionalSizeScale( int style );
  691. extern int            UI_ProportionalStringWidth( const char* str );
  692. extern void            UI_DrawString( int x, int y, const char* str, int style, vec4_t color );
  693. extern void            UI_DrawChar( int x, int y, int ch, int style, vec4_t color );
  694. extern qboolean     UI_CursorInRect (int x, int y, int width, int height);
  695. extern void            UI_AdjustFrom640( float *x, float *y, float *w, float *h );
  696. extern void            UI_DrawTextBox (int x, int y, int width, int lines);
  697. extern qboolean        UI_IsFullscreen( void );
  698. extern void            UI_SetActiveMenu( uiMenuCommand_t menu );
  699. extern void            UI_PushMenu ( menuframework_s *menu );
  700. extern void            UI_PopMenu (void);
  701. extern void            UI_ForceMenuOff (void);
  702. extern char            *UI_Argv( int arg );
  703. extern char            *UI_Cvar_VariableString( const char *var_name );
  704. extern void            UI_Refresh( int time );
  705. extern void            UI_KeyEvent( int key );
  706. extern qboolean        m_entersound;
  707. extern uiStatic_t    uis;
  708.  
  709. void UI_DrawText            ( float x, float y, qhandle_t font, float scale, vec4_t color, const char* text, int limit, int flags );
  710. void UI_DrawTextWithCursor    ( float x, float y, qhandle_t font, float scale, vec4_t color, const char* text, int limit, int flags, int cursorPos, char cursor );
  711.  
  712. //
  713. // ui_spLevel.c
  714. //
  715. void UI_SPLevelMenu_Cache( void );
  716. void UI_SPLevelMenu( void );
  717. void UI_SPLevelMenu_f( void );
  718. void UI_SPLevelMenu_ReInit( void );
  719.  
  720. //
  721. // ui_spArena.c
  722. //
  723. void UI_SPArena_Start( const char *arenaInfo );
  724.  
  725. //
  726. // ui_spPostgame.c
  727. //
  728. void UI_SPPostgameMenu_Cache( void );
  729. void UI_SPPostgameMenu_f( void );
  730.  
  731. //
  732. // ui_spSkill.c
  733. //
  734. void UI_SPSkillMenu( const char *arenaInfo );
  735. void UI_SPSkillMenu_Cache( void );
  736.  
  737. //
  738. // ui_syscalls.c
  739. //
  740.  
  741. void            trap_Parental_Update        ( void );
  742. void            trap_Parental_SetPassword    ( const char* password );
  743. void            trap_Parental_GetPassword    ( char* password, int size );
  744.  
  745. void            trap_Print( const char *string );
  746. void            trap_Error( const char *string );
  747. int                trap_Milliseconds( void );
  748. void            trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags, float MinValue, float MaxValue );
  749. void            trap_Cvar_Update( vmCvar_t *vmCvar );
  750. void            trap_Cvar_Set( const char *var_name, const char *value );
  751. float            trap_Cvar_VariableValue( const char *var_name );
  752. void            trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
  753. void            trap_Cvar_SetValue( const char *var_name, float value );
  754. void            trap_Cvar_Reset( const char *name );
  755. void            trap_Cvar_Create( const char *var_name, const char *var_value, int flags );
  756. void            trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize );
  757. int                trap_Argc( void );
  758. void            trap_Argv( int n, char *buffer, int bufferLength );
  759. void            trap_Cmd_ExecuteText( int exec_when, const char *text );    // don't use EXEC_NOW!
  760. int                trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
  761. void            trap_FS_Read( void *buffer, int len, fileHandle_t f );
  762. void            trap_FS_Write( const void *buffer, int len, fileHandle_t f );
  763. void            trap_FS_FCloseFile( fileHandle_t f );
  764. int                trap_FS_GetFileList(  const char *path, const char *extension, char *listbuf, int bufsize );
  765. qhandle_t        trap_R_RegisterModel( const char *name );
  766. qhandle_t        trap_R_RegisterSkin( const char *name );
  767. qhandle_t        trap_R_RegisterShaderNoMip( const char *name );
  768. void            trap_R_ClearScene( void );
  769. void            trap_R_AddRefEntityToScene( const refEntity_t *re );
  770. void            trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts );
  771. void            trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b );
  772. void            trap_R_RenderScene( const refdef_t *fd );
  773. void            trap_R_SetColor( const float *rgba );
  774. void            trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, const float* color, qhandle_t hShader );
  775. void            trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
  776. void            trap_UpdateScreen( qboolean IsLoading );
  777. int                trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName );
  778. void            trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
  779. sfxHandle_t        trap_S_RegisterSound( const char *sample );
  780. void            trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen );
  781. void            trap_Key_GetBindingBuf( int keynum, char *buf, int buflen );
  782. void            trap_Key_SetBinding( int keynum, const char *binding );
  783. qboolean        trap_Key_IsDown( int keynum );
  784. qboolean        trap_Key_GetOverstrikeMode( void );
  785. void            trap_Key_SetOverstrikeMode( qboolean state );
  786. void            trap_Key_ClearStates( void );
  787. int                trap_Key_GetCatcher( void );
  788. void            trap_Key_SetCatcher( int catcher );
  789. void            trap_GetClipboardData( char *buf, int bufsize );
  790. void            trap_GetClientState( uiClientState_t *state );
  791. void            trap_GetGlconfig( glconfig_t *glconfig );
  792. int                trap_GetConfigString( int index, char* buff, int buffsize );
  793. int                trap_LAN_GetServerCount( int source );
  794. void            trap_LAN_GetServerAddressString( int source, int n, char *buf, int buflen );
  795. void            trap_LAN_GetServerInfo( int source, int n, char *buf, int buflen );
  796. int                trap_LAN_GetServerPing( int source, int n );
  797. int                trap_LAN_GetPingQueueCount( void );
  798. void            trap_LAN_ClearPing( int n );
  799. void            trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime );
  800. void            trap_LAN_GetPingInfo( int n, char *buf, int buflen );
  801. void            trap_LAN_LoadCachedServers();
  802. void            trap_LAN_SaveCachedServers();
  803. void            trap_LAN_MarkServerVisible(int source, int n, qboolean visible);
  804. int                trap_LAN_ServerIsVisible( int source, int n);
  805. qboolean        trap_LAN_UpdateVisiblePings( int source );
  806. int                trap_LAN_AddServer(int source, const char *name, const char *addr);
  807. void            trap_LAN_RemoveServer(int source, const char *addr);
  808. void            trap_LAN_ResetPings(int n);
  809. int                trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen );
  810. int                trap_LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 );
  811. int                trap_MemoryRemaining( void );
  812. void            trap_GetCDKey( char *buf, int buflen );
  813. void            trap_SetCDKey( char *buf );
  814. qhandle_t        trap_R_RegisterFont(const char *pFontname);
  815. int                trap_R_GetTextWidth            ( const char* text, qhandle_t font, float scale, int limit );
  816. int                trap_R_GetTextHeight        ( const char* text, qhandle_t font, float scale, int limit );
  817. void            trap_R_DrawText                ( int x, int y, qhandle_t font, float scale, vec4_t color, const char* text, int limit, int flags );
  818. void            trap_R_DrawTextWithCursor    ( int x, int y, qhandle_t font, float scale, vec4_t color, const char* text, int limit, int flags, int cursorPos, char cursor );
  819. void            trap_S_StopBackgroundTrack    ( void );
  820. void            trap_S_StartBackgroundTrack    ( const char *intro, const char *loop, qboolean bReturnWithoutStarting);
  821. int                trap_CIN_PlayCinematic        ( const char *arg0, int xpos, int ypos, int width, int height, int bits);
  822. e_status        trap_CIN_StopCinematic        ( int handle );
  823. e_status        trap_CIN_RunCinematic        ( int handle );
  824. void            trap_CIN_DrawCinematic        ( int handle );
  825. void            trap_CIN_SetExtents            ( int handle, int x, int y, int w, int h );
  826. int                trap_RealTime                ( qtime_t *qtime );
  827. void            trap_R_RemapShader            ( const char *oldShader, const char *newShader, const char *timeOffset );
  828. qboolean        trap_VerifyCDKey            ( const char *key );
  829.  
  830. // CG specific API access
  831. void        trap_G2_ListModelSurfaces(void *ghlInfo);
  832. void        trap_G2_ListModelBones(void *ghlInfo, int frame);
  833. int            trap_G2API_AddBolt(void *ghoul2, const int modelIndex, const char *boneName);
  834. qboolean    trap_G2API_RemoveBolt(void *ghlInfo, const int modelIndex, const int index);
  835. qboolean    trap_G2API_AttachG2Model(void *ghoul2From, int modelFrom, void *ghoul2To, int toBoltIndex, int toModel);
  836. void        trap_G2_SetGhoul2ModelIndexes(void *ghoul2, qhandle_t *modelList, qhandle_t *skinList);
  837. qboolean    trap_G2_HaveWeGhoul2Models(void *ghoul2);
  838. qboolean    trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
  839.                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
  840. int            trap_G2API_InitGhoul2Model(void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin,
  841.                           qhandle_t customShader, int modelFlags, int lodBias);
  842.  
  843. int            trap_G2API_CopyGhoul2Instance(void *g2From, void *g2To, int modelIndex);
  844. int            trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo);
  845. void        trap_G2API_DuplicateGhoul2Instance(void *g2From, void **g2To);
  846. qboolean    trap_G2API_RemoveGhoul2Model(void **ghlInfo, int modelIndex);
  847. void        trap_G2API_CleanGhoul2Models(void **ghoul2Ptr);
  848.  
  849. qboolean    trap_G2API_SetBoneAngles(void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags,
  850.                                 const int up, const int right, const int forward, qhandle_t *modelList,
  851.                                 int blendTime , int currentTime );
  852. char        *trap_G2API_GetGLAName(void *ghoul2, int modelIndex);
  853. qboolean    trap_G2API_SetBoneAnim(void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame,
  854.                               const int flags, const float animSpeed, const int currentTime, const float setFrame , const int blendTime );
  855. qboolean    trap_G2API_SetSurfaceOnOff(void *ghoul2, const int modelIndex, const char *surfaceName, const int flags);
  856. qboolean    trap_G2API_GetAnimFileNameIndex (TGhoul2 ghoul2, qhandle_t modelIndex, const char* name );
  857. qhandle_t    trap_G2API_RegisterSkin ( const char *skinName, int numPairs, const char *skinPairs);
  858. qboolean    trap_G2API_SetSkin        ( TGhoul2 ghoul2, int modelIndex, qhandle_t customSkin);
  859.  
  860. void        *trap_VM_LocalAlloc ( int size );
  861. void        *trap_VM_LocalAllocUnaligned ( int size );            // WARNING!!!! USE WITH CAUTION!!! BEWARE OF DOG!!!
  862. void        *trap_VM_LocalTempAlloc( int size );
  863. void        trap_VM_LocalTempFree( int size );                    // free must be in opposite order of allocation!
  864. const char    *trap_VM_LocalStringAlloc ( const char *source );
  865.  
  866. qboolean    trap_NET_Available(void);
  867.  
  868. void        trap_Version_GetDescription(char *description, int length);
  869. int            trap_Version_GetNumSites(void);
  870. void        trap_Version_GetSite(int index, char *site, int length);
  871. void        trap_Version_Download(int index);
  872.  
  873. //
  874. // ui_addbots.c
  875. //
  876. void UI_AddBots_Cache( void );
  877. void UI_AddBotsMenu( void );
  878.  
  879. //
  880. // ui_removebots.c
  881. //
  882. void UI_RemoveBots_Cache( void );
  883. void UI_RemoveBotsMenu( void );
  884.  
  885. //
  886. // ui_teamorders.c
  887. //
  888. extern void UI_TeamOrdersMenu( void );
  889. extern void UI_TeamOrdersMenu_f( void );
  890. extern void UI_TeamOrdersMenu_Cache( void );
  891.  
  892. //
  893. // ui_loadconfig.c
  894. //
  895. void UI_LoadConfig_Cache( void );
  896. void UI_LoadConfigMenu( void );
  897.  
  898. //
  899. // ui_saveconfig.c
  900. //
  901. void UI_SaveConfigMenu_Cache( void );
  902. void UI_SaveConfigMenu( void );
  903.  
  904. //
  905. // ui_display.c
  906. //
  907. void UI_DisplayOptionsMenu_Cache( void );
  908. void UI_DisplayOptionsMenu( void );
  909.  
  910. //
  911. // ui_sound.c
  912. //
  913. void UI_SoundOptionsMenu_Cache( void );
  914. void UI_SoundOptionsMenu( void );
  915.  
  916. //
  917. // ui_network.c
  918. //
  919. void UI_NetworkOptionsMenu_Cache( void );
  920. void UI_NetworkOptionsMenu( void );
  921.  
  922. //
  923. // ui_gameinfo.c
  924. //
  925. typedef enum {
  926.     AWARD_ACCURACY,
  927.     AWARD_IMPRESSIVE,
  928.     AWARD_EXCELLENT,
  929.     AWARD_GAUNTLET,
  930.     AWARD_FRAGS,
  931.     AWARD_PERFECT
  932. } awardType_t;
  933.  
  934. const char *UI_GetArenaInfoByNumber( int num );
  935. const char *UI_GetArenaInfoByMap( const char *map );
  936. const char *UI_GetSpecialArenaInfo( const char *tag );
  937. int UI_GetNumArenas( void );
  938. int UI_GetNumSPArenas( void );
  939. int UI_GetNumSPTiers( void );
  940.  
  941. char *UI_GetBotInfoByNumber( int num );
  942. char *UI_GetBotInfoByName( const char *name );
  943. int UI_GetNumBots( void );
  944. void UI_LoadBots( void );
  945. char *UI_GetBotNameByNumber( int num );
  946.  
  947. void UI_GetBestScore( int level, int *score, int *skill );
  948. void UI_SetBestScore( int level, int score );
  949. int UI_TierCompleted( int levelWon );
  950. qboolean UI_ShowTierVideo( int tier );
  951. qboolean UI_CanShowTierVideo( int tier );
  952. int  UI_GetCurrentGame( void );
  953. void UI_NewGame( void );
  954. void UI_LogAwardData( int award, int data );
  955. int UI_GetAwardLevel( int award );
  956.  
  957. void UI_SPUnlock_f( void );
  958. void UI_SPUnlockMedals_f( void );
  959.  
  960. void UI_InitGameinfo( void );
  961.  
  962. //
  963. // ui_login.c
  964. //
  965. void Login_Cache( void );
  966. void UI_LoginMenu( void );
  967.  
  968. //
  969. // ui_signup.c
  970. //
  971. void Signup_Cache( void );
  972. void UI_SignupMenu( void );
  973.  
  974. //
  975. // ui_rankstatus.c
  976. //
  977. void RankStatus_Cache( void );
  978. void UI_RankStatusMenu( void );
  979.  
  980.  
  981. // new ui 
  982.  
  983. #define ASSET_BACKGROUND "uiBackground"
  984.  
  985. // for tracking sp game info in Team Arena
  986. typedef struct postGameInfo_s {
  987.     int score;
  988.     int redScore;
  989.     int blueScore;
  990.     int perfects;
  991.     int accuracy;
  992.     int impressives;
  993.     int excellents;
  994.     int defends;
  995.     int assists;
  996.     int gauntlets;
  997.     int    captures;
  998.     int time;
  999.     int timeBonus;
  1000.     int shutoutBonus;
  1001.     int skillBonus;
  1002.     int baseScore;
  1003. } postGameInfo_t;
  1004.  
  1005.  
  1006.  
  1007. #endif
  1008.